package com.stx.entity;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="fc_user")
@SequenceGenerator(name="us_id",sequenceName="us_id",initialValue=1,allocationSize=1)
public class User {
	 @Id
	 @Column(nullable=false)
	 @GeneratedValue(generator="us_id",strategy=GenerationType.SEQUENCE)
	 private long us_id;
	 private int  us_type;
	 @Column(length=30,nullable=false,unique=true)
	 private String us_email;
	 @Column(length=20,nullable=false)
	 private String us_nickname;
	 @Column(length=50,nullable=false)
	 private  String us_password;
	 private String us_image;
	 @Column(updatable=false)
	 private Date  us_createtime;
	 
	 
	 
	 @OneToMany(cascade={CascadeType.ALL},fetch=FetchType.EAGER,mappedBy="user")
	private Set<Film_comment>film_comment=new HashSet<Film_comment>();
	
	 @OneToMany(cascade={CascadeType.ALL},fetch=FetchType.EAGER,mappedBy="user")
	private Set<User_collection>us_collection=new HashSet<User_collection>();
	
	
	
	
	public Set<User_collection> getUs_collection() {
		return us_collection;
	}
	public void setUs_collection(Set<User_collection> us_collection) {
		this.us_collection = us_collection;
	}
	public Set<Film_comment> getFilm_comment() {
		return film_comment;
	}
	public void setFilm_comment(Set<Film_comment> film_comment) {
		this.film_comment = film_comment;
	}
	public long getUs_id() {
		return us_id;
	}
	public void setUs_id(long us_id) {
		this.us_id = us_id;
	}
	public int getUs_type() {
		return us_type;
	}
	public void setUs_type(int us_type) {
		this.us_type = us_type;
	}
	public String getUs_email() {
		return us_email;
	}
	public void setUs_email(String us_email) {
		this.us_email = us_email;
	}
	public String getUs_nickname() {
		return us_nickname;
	}
	public void setUs_nickname(String us_nickname) {
		this.us_nickname = us_nickname;
	}
	public String getUs_password() {
		return us_password;
	}
	public void setUs_password(String us_password) {
		this.us_password = us_password;
	}
	public String getUs_image() {
		return us_image;
	}
	public void setUs_image(String us_image) {
		this.us_image = us_image;
	}
	public Date getUs_createtime() {
		return us_createtime;
	}
	public void setUs_createtime(Date us_createtime) {
		this.us_createtime = us_createtime;
	}	
}
